<?php TPL::output('admin/global/header.tpl.htm'); ?>
<?php TPL::output('admin/global/nav_menu.tpl.htm'); ?>

<div class="aw-content-wrap">
	<div class="mod">
		<div class="mod-head">
			<h3>
				<ul class="nav nav-tabs">
					<li class="active"><a href="#list" data-toggle="tab"><?php _e('问题评论管理'); ?></a></li>
					<li><a href="#search" data-toggle="tab"><?php _e('搜索'); ?></a></li>
					<li><a href="#remove" data-toggle="tab"><?php _e('已删除'); ?></a></li>
				</ul>
			</h3>
		</div>
		<div class="mod-body tab-content">
			<div class="tab-pane active" id="list">
				<?php if ($_GET['action'] == 'search') { ?>
				<div class="alert alert-info"><?php _e('找到 %s 条符合条件的内容', intval($this->comment_count)); ?></div>
				<?php } ?>

				<form id="batchs_form" action="admin/comment/question_comment_manage/" method="post">
				<input type="hidden" id="action" name="action" value="" />
				<div class="table-responsive">
				<?php if ($this->list) { ?>
					<table class="table table-striped">
						<thead>
							<tr>
								<th><input type="checkbox" class="check-all"></th>
								<th><?php _e('ID'); ?></th>
								<th><?php _e('问题ID'); ?></th>
								<th><?php _e('内容'); ?></th>
								<th><?php _e('作者'); ?></th>
								<th><?php _e('发布时间'); ?></th>
							</tr>
						</thead>
						<tbody>
							<?php foreach ($this->list AS $key => $val) { ?>
							<tr>
								<td><input type="checkbox" name="ids[]" value="<?php echo $val['id']; ?>"></td>
								<td><?php echo $val['id']; ?></td>
								<td><a href="question/<?php echo $val['question_id']; ?>" target="_blank"><?php echo $val['question_id']; ?></a></td>
								<td style="text-align:left;"><?php echo strip_tags(html_entity_decode($val['message'])); ?></td>
								<td><a href="people/<?php echo $val['user_info']['uid']; ?>" target="_blank"><?php echo $val['user_info']['user_name']; ?></a></td>
								<td><?php echo date_friendly($val['time']); ?></td>
							</tr>
							<?php } ?>
						</tbody>
					</table>
				<?php } ?>
				</div>
				</form>
				<div class="mod-table-foot">
					<?php echo $this->pagination; ?>

					<a class="btn btn-danger" onclick="$('#action').val('remove'); AWS.ajax_post($('#batchs_form'));"><?php _e('删除'); ?></a>
				</div>
			</div>

			<div class="tab-pane" id="search">
				<form method="post" action="admin/comment/question_comment_list/" onsubmit="return false;" id="search_form" class="form-horizontal" role="form">

					<input name="action" type="hidden" value="search" />

					<div class="form-group">
						<label class="col-sm-2 col-xs-3 control-label"><?php _e('关键词'); ?>:</label>

						<div class="col-sm-5 col-xs-8">
							<input class="form-control" type="text" value="<?php echo rawurldecode($_GET['keyword']); ?>" name="keyword" />
						</div>
					</div>

					<div class="form-group">
						<label class="col-sm-2 col-xs-3 control-label"><?php _e('发起时间范围'); ?>:</label>

						<div class="col-sm-6 col-xs-9">
							<div class="row">
								<div class="col-xs-11  col-sm-5 mod-double">
									<input type="text" class="form-control mod-data" value="<?php echo base64_decode($_GET['start_date']); ?>" name="start_date" />
									<i class="icon icon-date"></i>
								</div>
								<span class="mod-symbol col-xs-1 col-sm-1">
								-
								</span>
								<div class="col-xs-11 col-sm-5">
									<input type="text" class="form-control mod-data" value="<?php echo base64_decode($_GET['end_date']); ?>" name="end_date" />
									<i class="icon icon-date"></i>
								</div>
							</div>
						</div>
					</div>

					<div class="form-group">
						<label class="col-sm-2 col-xs-3 control-label"><?php _e('作者'); ?>:</label>

						<div class="col-sm-5 col-xs-8">
							<input class="form-control" type="text" value="<?php echo $_GET['user_name']; ?>" name="user_name" />
						</div>
					</div>

					<div class="form-group">
						<div class="col-sm-offset-2 col-sm-5 col-xs-8">
							<button type="button" onclick="AWS.ajax_post($('#search_form'));" class="btn btn-primary"><?php _e('搜索'); ?></button>
						</div>
					</div>
				</form>
			</div>
			<div class="tab-pane" id="remove">
				<form id="remove_comment" action="admin/comment/question_comment_manage/" method="post">
					<input type="hidden" id="remove_action" name="action" value="" />
					<div class="table-responsive">
						<?php if ($this->remove_list) { ?>
						<table class="table table-striped">
							<thead>
							<tr>
								<th><input type="checkbox" class="check-all"></th>
								<th><?php _e('ID'); ?></th>
								<th><?php _e('问题id'); ?></th>
								<th><?php _e('内容'); ?></th>
								<th><?php _e('作者'); ?></th>
								<th><?php _e('发布时间'); ?></th>
							</tr>
							</thead>
							<tbody>
							<?php foreach ($this->remove_list AS $key => $val) { ?>
							<tr>
								<td><input type="checkbox" name="ids[]" value="<?php echo $val['id']; ?>"></td>
								<td><?php echo $val['id']; ?></td>
								<td><a href="question/<?php echo $val['question_id']; ?>" target="_blank"><?php echo $val['question_id']; ?></a></td>
								<td style="text-align:left;"><?php echo strip_tags(html_entity_decode($val['message'])); ?></td>
								<td><a href="people/<?php echo $val['user_info']['uid']; ?>" target="_blank"><?php echo $val['user_info']['user_name']; ?></a></td>
								<td><?php echo date_friendly($val['time']); ?></td>
							</tr>
							<?php } ?>
							</tbody>
						</table>
						<?php } ?>
					</div>
				</form>
				<div class="mod-table-foot">
					<?php echo $this->remove_pagination; ?>
					<a class="btn btn-danger" onclick="$('#remove_action').val('recover'); AWS.ajax_post($('#remove_comment'));"><?php _e('恢复'); ?></a>
					<a class="btn btn-danger" onclick="$('#remove_action').val('clear'); AWS.ajax_post($('#remove_comment'));"><?php _e('清空回收站'); ?></a>
				</div>
			</div>
		</div>
	</div>
</div>

<?php TPL::output('admin/global/footer.tpl.htm'); ?>